package com.batchap.classes;

import java.io.IOException;

import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;
import javax.microedition.lcdui.game.Sprite;

public class MySprite extends Sprite{

    public MySprite(Image image, int width, int height) {
		super(image, width, height);
	}
    public MySprite(Image image) {
		super(image);
	}
    public MySprite(Sprite sprite) {
		super(sprite);
	}
    
    public MySprite(String imageStr, int width, int height) throws IOException{
		super(Image.createImage(imageStr), width, height);
	}
    public MySprite(String imageStr) throws IOException{
		super(Image.createImage(imageStr));
	}

    public void Draw(Graphics g)
    {
    	this.paint(g);
    }
    
	public boolean IsClicked(int x, int y)
    {
        //if (Left <= x && Left + Width >= x && Top <= y && Top + Height >= y && this.isVisible())
		if (this.getX() <= x && this.getX() + this.getWidth() >= x
				&& this.getY() <= y && this.getY() + this.getHeight() >= y
				&& this.isVisible())
        {
            return true;
        }
        return false;
    }

}
